#ifndef FILEDOWNLOAD_H
#define FILEDOWNLOAD_H

#include <QWidget>
#include <QTime>
#include "DownLoadManager.h"
#include <QDebug>
#include <QDir>
class DownLoadManager;
namespace Ui {
class FileDownLoad;
}

class FileDownLoad : public QWidget
{
    Q_OBJECT

public:
    explicit FileDownLoad(QWidget *parent = 0);
    ~FileDownLoad();
private:
    void initWindow();
    QString transformUnit(qint64 bytes , bool isSpeed = false);
    QString transformTime(qint64 seconds);

private slots:
    void onStartDownload();
    void onStopDownload();
    void onCloseDownload();

    void onDownloadProcess(qint64 bytesReceived, qint64 bytesTotal);
    void onReplyFinished(int);
private:
    void resteALL();
private:
    Ui::FileDownLoad *ui;
    DownLoadManager *m_downloadManager;
    QString m_url;
    uint m_timeInterval;
    qint64 m_currentDownload;
    qint64 m_intervalDownload;
    QTime m_timeRecord;
};

#endif // FILEDOWNLOAD_H
